﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace MathsLibrary
{
    static class Numbers
    {
      //  public static int num;
        public static void Chetn(int num)
        {
            if ((num & 1) != 1)
                Console.WriteLine(num + " - Even number");
            else
                Console.WriteLine(num + " - Odd number");
         //   return 0;
        }
        public static int SecondPower(this int num)
        {
            int sqr = num * num;
         //   Console.WriteLine(sqr + " is square of {0}",num);
            return sqr;
        }
        public static void Binary(int num)
        {
            Console.WriteLine("{0} in binary-number system is", num);
            for (int t = 128; t > 0; t = t / 2)
            {
                if ((num & t) != 0) Console.WriteLine("\t1");
                if ((num & t) == 0) Console.WriteLine("\t0");
            }
        }
        public static void Positivity(int num)
        {
            if (num == 0)
                Console.WriteLine(num + " this is 0");
            if (num > 0)
                Console.WriteLine(num + " is positive");
            if (num < 0)
                Console.WriteLine(num + " is negative");
        }
        public static bool Simple(int num)
        {
            for (int i = 2; i < num / 2 + 1; i++)
                if ((num % i) == 0)
                {
                    return false;
                }
            return true;
        }
    }
}
